package com.grass.p019lv;

import android.app.Application;
import android.os.Environment;
import com.androidx.p013lv.base.BaseApp;
import com.androidx.p013lv.base.BaseSdk;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.utils.BuildConfigUtils;

import com.danikula.videocache.HttpProxyCacheServer;
import com.flurry.android.FlurryAgent;
import com.shuyu.gsyvideoplayer.cache.CacheFactory;
import com.shuyu.gsyvideoplayer.player.PlayerFactory;
import com.shuyu.gsyvideoplayer.utils.GSYVideoType;


import cn.bingoogolapple.swipebacklayout.BGASwipeBackHelper;
import jaygoo.library.m3u8downloader.M3U8DownloaderConfig;
import tv.danmaku.ijk.media.exo2.Exo2PlayerManager;
import tv.danmaku.ijk.media.exo2.ExoPlayerCacheManager;
import tv.danmaku.ijk.media.exo2.ExoSourceManager;
import tv.danmaku.ijk.media.player.IjkMediaMeta;
/*import p000a.shuyu.p005a.cache.CacheFactory;
import p000a.shuyu.p005a.player.PlayerFactory;
import p000a.shuyu.p005a.utils.GSYVideoType;
import p031tv.danmaku.ijk.media.exo2.Exo2PlayerManager;
import p031tv.danmaku.ijk.media.exo2.ExoPlayerCacheManager;
import p031tv.danmaku.ijk.media.exo2.ExoSourceManager;
import p031tv.danmaku.ijk.media.player.IjkMediaMeta;*/

/* renamed from: com.grass.lv.App */
public class App extends BaseApp {
    public static int chapterId;
    public static String floatingCoverImg;
    public static boolean gameSwitch;
    private static HttpProxyCacheServer httpProxyCacheServer;
    public static int novelId;
    private static Application theApplication;
    private String dirPath;

    @Override // com.androidx.p013lv.base.BaseApp
    public void onCreate() {
        super.onCreate();
        theApplication = this;
        BuildConfigUtils.init(false);
        BaseSdk.init(this);
        playerInit();
        new FlurryAgent.Builder().withLogEnabled(true).build(this, Key.FLURRY_KEY);
        this.dirPath = Environment.getExternalStorageDirectory().getPath() + "/kbDownloader";
        M3U8DownloaderConfig.build(getApplicationContext()).setSaveDir(this.dirPath).setDebugMode(true);
        BGASwipeBackHelper.init(this, null);
    }

    public static synchronized HttpProxyCacheServer getProxy() {
        HttpProxyCacheServer httpProxyCacheServer2;
        synchronized (App.class) {
            if (httpProxyCacheServer == null) {
                httpProxyCacheServer = new HttpProxyCacheServer.Builder(theApplication)
                        .maxCacheSize(IjkMediaMeta.AV_CH_STEREO_RIGHT)
                        /*.singleFileBandwidth(1500)*/.build();
            }
            httpProxyCacheServer2 = httpProxyCacheServer;
        }
        return httpProxyCacheServer2;
    }

    private void playerInit() {
        PlayerFactory.setPlayManager(Exo2PlayerManager.class);
        CacheFactory.setCacheManager(ExoPlayerCacheManager.class);
        GSYVideoType.setShowType(0);
        ExoSourceManager.setExoMediaSourceInterceptListener(new AndroidMediaSourceInterceptListener(this));
    }
}
